<?php
/**
 * script to automate the generation of the
 * package.xml file.
 *
 * $Id: package.php 442 2006-08-20 13:21:58Z schst $
 *
 * @author      Stephan Schmidt <schst@php-tools.net>
 * @package     XJConfForPHP
 * @subpackage  Tools
 */

/**
 * uses PackageFileManager
 */
require_once 'PEAR/PackageFileManager2.php';
require_once 'PEAR/PackageFileManager/Svn.php';

/**
 * current version
 */
$version = '0.1.2';

/**
 * Current API version
 */
$apiVersion = '0.1.2';

/**
 * current state
 */
$state = 'alpha';

/**
 * current API stability
 */
$apiStability = 'alpha';

/**
 * release notes
 */
$notes = <<<EOT
Feature addition:
This release enables using class loaders for differant namespaces which allows to load classes
at runtime of the XmlParser instead of having to load all classes before parsing the xml files.
Bugfix:
The ConstructorValueConverter now works with all examples.
EOT;

/**
 * package description
 */
$description = <<<EOT
XJConfForPHP is a port of XJConf. It enables you to create complex data structures consisting of
objects, arrays and primitives from virtually any XML document. It provides a simple XML language
to define the XML-to-object mappings. It features namespace support and is easily extendible.
EOT;

$package = new PEAR_PackageFileManager2();

$result = $package->setOptions(array(
    'filelistgenerator' => 'svn',
    'ignore'            => array( 'package.php', 'package.xml', '.svn', 'rfcs' ),
    'simpleoutput'      => true,
    'baseinstalldir'    => '/',
    'packagedirectory'  => './',
    'dir_roles'         => array(
								 'docs' => 'doc',
                                 'examples' => 'doc',
                                 'tests' => 'test',
                                 )
    ));
if (PEAR::isError($result)) {
    echo $result->getMessage();
    die();
}

$package->setPackage('XJConfForPHP');
$package->setSummary('XML-to-object mapper.');
$package->setDescription($description);

$package->setChannel('pear.php-tools.net');
$package->setAPIVersion($apiVersion);
$package->setReleaseVersion($version);
$package->setReleaseStability($state);
$package->setAPIStability($apiStability);
$package->setNotes($notes);
$package->setPackageType('php');
$package->setLicense('LGPL', 'http://www.gnu.org/copyleft/lesser.txt');

$package->addMaintainer('lead', 'schst', 'Stephan Schmidt', 'schst@xjconf.net', 'yes');
$package->addMaintainer('lead', 'mikey', 'Frank Kleine', 'mikey@xjconf.net', 'yes');

$package->setPhpDep('5.0.0');
$package->setPearinstallerDep('1.4.0');

$package->addExtensionDep('required', 'xmlreader');

$package->generateContents();

if (isset($_GET['make']) || (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'make')) {
    $result = $package->writePackageFile();
} else {
    $result = $package->debugPackageFile();
}

if (PEAR::isError($result)) {
    echo $result->getMessage();
    die();
}
?>